﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class IframeSuppling : System.Web.UI.Page
{
    Connectdbnour con = new Connectdbnour();
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = GlobalClass.Name;
        Label2.Text = GlobalClass.ShowDate;
        Label3.Text = GlobalClass.Unit;
        Label4.Text = GlobalClass.Bill;
        Label11.Text = GlobalClass.Discount;
        Label8.Text = GlobalClass.Brandlens;
        Label9.Text = GlobalClass.Brandsoln;
        Label10.Text = GlobalClass.Brandaccs;
        Label12.Text = GlobalClass.Unitone;
        Label13.Text = GlobalClass.Unittwo;
        Label14.Text = GlobalClass.Unitthree;
        Label15.Text = GlobalClass.VD;
        Label16.Text = GlobalClass.Color;
        Label17.Text = GlobalClass.Pck;
        Label18.Text = GlobalClass.Sph;
        Label19.Text = GlobalClass.Cyl;
        Label20.Text = GlobalClass.Axis;
        Label21.Text = GlobalClass.Bc;
        Label22.Text = GlobalClass.Diam;
        Label23.Text = GlobalClass.Lot;
        Label24.Text = GlobalClass.Exdate;
    }
    protected void  Button1_Click(object sender, EventArgs e)
    {
        if (CheckBox1.Checked == false)
        {
            if (Label17.Text == "1")
            {
                con.Addflens(Label8.Text, Label15.Text, Label16.Text, 1, Convert.ToDouble(Label18.Text), Convert.ToDouble(Label19.Text), Convert.ToDouble(Label20.Text), Convert.ToDouble(Label21.Text), Convert.ToDouble(Label22.Text), Label23.Text, Label24.Text, Convert.ToInt16(TextBox3.Text));
            }
            else
            {
                con.Addflens(Label8.Text, "Disposable", Label16.Text, Convert.ToInt16(Label17.Text), Convert.ToDouble(Label18.Text), Convert.ToDouble(Label19.Text), Convert.ToDouble(Label20.Text), Convert.ToDouble(Label21.Text), Convert.ToDouble(Label22.Text), Label23.Text, Label24.Text, Convert.ToInt16(TextBox3.Text));
            }
        }
        else if (CheckBox1.Checked == true)
        {
            if (Label17.Text == "1")
            {
                con.Addfklens(Label8.Text, Label15.Text, Label16.Text, 1, Convert.ToDouble(Label18.Text), Convert.ToDouble(Label19.Text), Convert.ToDouble(Label20.Text), Convert.ToDouble(Label21.Text), Convert.ToDouble(Label22.Text), Label23.Text, Label24.Text, Convert.ToInt16(TextBox3.Text));
            }
            else
            {
                con.Addfklens(Label8.Text, "Disposable", Label16.Text, Convert.ToInt16(Label17.Text), Convert.ToDouble(Label18.Text), Convert.ToDouble(Label19.Text), Convert.ToDouble(Label20.Text), Convert.ToDouble(Label21.Text), Convert.ToDouble(Label22.Text), Label23.Text, Label24.Text, Convert.ToInt16(TextBox3.Text));
            }
        }
        Response.Redirect("IframeSuppling.aspx");
    }
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        String[] array = null;
        try
        {
            array = new String[2];

            array = con.ftos(Label4.Text, GlobalClass.Date, Label1.Text, Convert.ToDouble(Label3.Text), Convert.ToDouble(Label12.Text), Convert.ToDouble(Label13.Text), Convert.ToDouble(Label14.Text), Convert.ToDouble(Label11.Text));
        }
        catch (Exception ex)
        {
            Label5.Text = ex.Message;
            Label5.Visible = true;
        }
        GlobalClass.Sum = array[0];
        GlobalClass.Total = array[1];
        GlobalClass.Name = "";
        GlobalClass.ShowDate = "";
        GlobalClass.Date = "";
        GlobalClass.Unit = "";
        GlobalClass.Bill = "";
        GlobalClass.Discount = "";
        GlobalClass.Brandlens = "";
        GlobalClass.Brandsoln = "";
        GlobalClass.Brandaccs = "";
        GlobalClass.Unitone = "";
        GlobalClass.Unittwo = "";
        GlobalClass.Unitthree = "";
        Response.Redirect("IframeSuppling.aspx");
    }
    protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
    {
        
    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        if (CheckBox2.Checked == false)
        {
            con.Addfsoln(Label9.Text, Convert.ToInt16(DropDownList19.SelectedItem.ToString()), Convert.ToInt16(TextBox7.Text));
        }
        else if (CheckBox2.Checked == true)
        {
            con.Addfksoln(Label9.Text, Convert.ToInt16(DropDownList19.SelectedItem.ToString()), Convert.ToInt16(TextBox7.Text));
        }
        Response.Redirect("IframeSuppling.aspx");
    }
    protected void Button6_Click(object sender, EventArgs e)
    {
        if (CheckBox3.Checked == false)
        {
            con.Addfaccs(Label10.Text, Convert.ToInt16(TextBox8.Text));
        }
        else if (CheckBox3.Checked == true)
        {
            con.Addfkaccs(Label10.Text, Convert.ToInt16(TextBox8.Text));
        }
        Response.Redirect("IframeSuppling.aspx");
    }
    protected void CheckBox3_CheckedChanged(object sender, EventArgs e)
    {
        
    }
    
}